﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.Windows.Media.Imaging;
using HotSpot.Silverlight.Web.DomainServices;

namespace HotSpot.Silverlight
{
    public partial class HSHome : Page
    {
        public HSHome()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(HSHome_Loaded);
        }
        
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        void HSHome_Loaded(object sender, RoutedEventArgs e)
        {
            string url = HSResources.ImagePath;
            if (DateTime.Now.Second % 2 == 0)
            {
                url += "9";
            }
            else 
            {
                url += "10";
            }

            BitmapImage bmi = new BitmapImage(new Uri(url, UriKind.Absolute));
            PicOD.Source = bmi;

            HotSpotDomainContext hsContext = new HotSpotDomainContext();
            hsContext.Load(hsContext.GetAccommodationSearchQuery("", 0, 0, 0, false, false, false, false, false, false, false));
            TopHotelList.ItemsSource = hsContext.Accommodations;        
        }
    }
}
